<template>
  <div class="app-container">
    <div class="detailBox">
      <div class="touImg">
        <img v-if="form.avatar" :src="form.avatar" alt="">
        <img v-else src="../../static/avant.png" alt="" />
        <div class="name">{{form.nickName}}</div>
      </div>
      <div class="infoBox">
        <div class="list">
          <div class="lable">姓名：</div>
          <div class="content">{{form.name}}</div>
        </div>
        <div class="list">
          <div class="lable">手机号：</div>
          <div class="content">{{form.phoneNumber}}</div>
        </div>
        <div class="list">
          <div class="lable">我的邀请人：{{form.referrerNickName ? form.referrerNickName : '--'}}</div>
          <div class="content"></div>
        </div>
        <div class="list">
          <div class="lable">实名认证：</div>
          <div class="content" v-if="form.name && form.idCard">{{form.name}}({{form.idCard}})</div>
          <div class="icon" v-else>未实名</div>
        </div>
        <!-- <div class="list">
          <div class="lable">银行卡信息：</div>
          <div class="content" v-if="form.bankName && form.bankNo">{{form.bankName}}({{form.bankNo}})</div>
          <div class="icon" v-else>未上传</div>
        </div> -->
        <div class="list">
          <div class="lable">注册时间：</div>
          <div class="content">{{form.createTime}}</div>
        </div>
        <div class="list">
          <div class="lable">钱包地址：</div>
          <div class="content">{{form.blockchainAddress ? form.blockchainAddress : '--'}}</div>
        </div>
				 <div class="list">
          <div class="lable">推荐用户数量：{{form.referrerCount}}</div>
          <div class="content"></div>
        </div>
      </div>
    </div>
    <div class="tableBox">
      <el-table v-loading="loading" :data="cardList" stripe border>
        <el-table-column label="序号" type="index" width="55" align="center" fixed />
        <el-table-column label="头像" align="center" prop="name" :show-overflow-tooltip="true">
					<template slot-scope="scope">
           <div class="imgBox">
						 <img :src="scope.row.avatar" alt="">
					 </div>
          </template>
				</el-table-column>
        <el-table-column label="会员昵称" align="center" prop="nickName" :show-overflow-tooltip="true"/>
        <el-table-column label="姓名" align="center" prop="name" :show-overflow-tooltip="true" />
        <el-table-column label="手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" />
        <el-table-column label="注册时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
        @pagination="getList" />
    </div>
  </div>
</template>
<script>
  import {
    adminDict,
    getCustomer,
    referrerList,
  } from "@/api/members";
  import Dialog from "@/views/members/dialog";
  import NumDialog from "@/views/members/numDialog";
  export default {
    // dicts: ['customer_level_type', 'asset_card_class_type', 'asset_card_type', "customer_card_status",
    //   "asset_card_validity_type"
    // ],
    components: {
      Dialog,
      NumDialog
    },
    data() {
      return {
        loading: false,
        total: 0,
        form: {},
        cardList: [], //预付卡
        numList: [], //数字权益卡
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          customerId: '',
        },
      };
    },

    created() {
      let query = this.$route.query;
      console.log(query.id);
      this.queryParams.customerId = query.id;
      this.getInfo()
     this.getList()
    },
    methods: {
     
      getInfo() {
        getCustomer(this.queryParams.customerId).then(response => {
          this.form = response.data;
        });
      },
      //获取预付卡列表
      getList() {
        this.loading = true;
        referrerList(this.queryParams).then(response => {
          this.total = response.total
          this.cardList = response.rows
          this.loading = false;
        });
      },
    }
  };

</script>
<style lang="scss" scoped>
  // .app-container {
  //     background: #f5f5f5 !important;
  // }
  .detailBox {
    border-radius: 12px;
    padding: 20px;
    background: #fff;
    display: flex;
    justify-content: flex-start;
    align-items: center;

    .touImg {
      display: flex;
      flex-direction: column;
      align-items: center;

      img {
        width: 50px;
        height: 50px;
        border-radius: 50%;
      }

      .name {
        margin-top: 10px;
        font-size: 18px;
        font-weight: 500;
        color: #333;
      }
    }
  }

  .infoBox {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    margin-left: 24px;

    .list {
      width: 33.3%;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      font-size: 14px;
      color: #333;
      margin-top: 10px;

      .content {
        display: flex;
        flex: 1;
      }
    }
  }

  .icon {
    background: #ccc;
    color: #fff;
    font-size: 12px;
    height: 20px;
    line-height: 20px;
    padding: 0 8px;
    border-radius: 2px;
  }

  .card_img {
    width: 100px;
    height: 60px;
  }

  .tableBox {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
  }

</style>
